[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
mktime() Convert Time to Calendar Format
#include <time.h> Required for declarations only
time_t mktime(my_t);
struct tm *my_t; Time to convert
This function converts the time as stored in a tm structure to
calendar time (as used by the function time()). If the fields of
the tm structure are not in their proper ranges, they are
readjusted.
Returns: A time_t structure.
-------------------------------- Example ---------------------------------
This example converts 12/25/2000 to calendar time.
#include <stdio.h>
#include <time.h>
int main(void)
struct tm my_time;
int year, month, day;
year = 2000;
month = 12;
day = 25;
my_time.tm_year = year - 1900;
my_time.tm_mon = month - 1;
my_time.tm_mday = day;
my_time.tm_hour = 0;
my_time.tm_min = 0;
my_time.tm_sec = 1;
my_time.tm_isdst = -1;
mktime(&my_time); // Convert time.
See Also:
localtime()
strftime()
time()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson